<?php exit("breakcms"); ?>
{include file="public/not_index_header.php"}
{if $_POST['action']=='from'}
<div class="showinfo">
    
</div>
<form action="" method="post" onsubmit="">
    <div class="showtable2_head">
    	编辑权限组
    </div>
    <div class="showtable2_body">
        <table border="0" cellpadding="0" cellspacing="1" width="100%" class="tableborder">

            <tr>
                <td width="22%" align="right">权限组名&nbsp;&nbsp;</td>
                <td width="78%" align="left"><input name="group_name" type="text" class="input_text_default" value="{$THIS_RIGHT['group_name']}"/></td>
            </tr>
            <tr>
                <td width="22%" align="right">管理权限&nbsp;&nbsp;</td>
                <td width="78%" align="left">&nbsp;从下面的权限树上选择你需要的权限</td>
            </tr>
        </table>
        <br/>
        <div class="treeblock">
            {foreach from="$RIGHT_TREE"}
            <div style="width: 100%" id="tree_{$item[0]}" pid="{$item['pid']}" childnum="{$item['childnum']}">
                {$item[2]}<span><input type="checkbox" name="select_rights[]"  value="{$item[0]}" onclick="select_parent_node()" {if $item['checked']}checked="checked"{/if} /></span><span>{$item[1]}</span>
            </div>
            {/foreach}
        </div>
        <br/>
    </div>


    <div class="showbutton_right">
        <input value="保存" type="submit"  class="button"/>&nbsp;&nbsp;&nbsp;&nbsp;<input value="重置"   type="reset" class="button"/><input type="hidden" value="update"  name="postaction"/>
    </div>
</form>
{include file="public/not_index_footer.php"}
{literal}
<script language="javascript" type="text/javascript">
    hidechilds=function(num){
        var ev=window.event || arguments.callee.caller.arguments[0];
        var target=ev.target || ev.srcElement;
        $imgNUM=target.src.match(/\d+/);
        $action='show';
        switch(parseInt($imgNUM)){
            case 12:
                $action='none';
                $imgNUM=11;
                break;
            case 17:
                $action='none';
                $imgNUM=21;
                break;
            case 11:
                $action='block';
                $imgNUM=12;
                break;
            case 21:
                $action='block';
                $imgNUM=17;
                break;
        }
        target.src="system/data/treegif/"+$imgNUM+".gif";
        $div=target.parentNode;
        $parentNode=$div;
        $parentNode.setAttribute('status', $action);

        for(i=0;i<num;i++){
            $div=nextSibling($div)
            $parent=$('tree_'+$div.getAttribute('pid'));
            if($action=='none'){
                $div.style.display='none';
            }else{
                if($parent.style.display=='none'){
                    $div.style.display='none';
                }else{
                    $div.style.display=$parent.getAttribute('status')!=null?$parent.getAttribute('status'):'block';
                }
            }
        }
    }

    select_parent_node=function(){
        var ev=window.event || arguments.callee.caller.arguments[0];
        var target=ev.target || ev.srcElement;
        $thisDIVNode=target.parentNode.parentNode;
        $parent=$('tree_'+$thisDIVNode.getAttribute('pid'));
        if(target.checked==true){
            _select_parent_node($parent);
        }else{
            num=$thisDIVNode.getAttribute('childnum');
            for(i=0;i<num;i++){
                $thisDIVNode=nextSibling($thisDIVNode)
                $$($thisDIVNode,'input')[0].checked=false;
            }
        }
    }

    _select_parent_node=function($parent){
        if($parent==null) return;
        $$($parent,'input')[0].checked=true;
        $parent=$('tree_'+$parent.getAttribute('pid'));
        if($parent!=null) _select_parent_node($parent);
    }

</script>
{/literal}
{include file="public/not_index_footer.php"}
{elseif $_POST['action']=='message' || $_POST['action']=='error' || $_POST['action']=='update'}
{include file="public/message.php"}
{include file="public/not_index_footer.php"}
{/if}
